using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace BMC.ARSystem
{
	[ClassInterface, Guid("07ec16c5-6407-4040-b1dd-956801b1fe62"), ProgId("BMC.ARSystem.OpenWindowAction")]
	public class OpenWindowAction : Action
	{
		[ARStructMemTypeInfo(Name = "serverName", Offset = 0u)]
		private string _serverName;
		[ARStructMemTypeInfo(Name = "formName", Offset = 1u)]
		private string _formName;
		[ARStructMemTypeInfo(Name = "vuiLabel", Offset = 2u)]
		private string _vuiLabel;
		[ARStructMemTypeInfo(Name = "closeBox", Offset = 3u)]
		private bool _closeBox;
		[ARStructMemTypeInfo(Name = "inputValueFieldPairs", Offset = 4u)]
		private ArrayList _inputValueFieldPairs;
		[ARStructMemTypeInfo(Name = "outputValueFieldPairs", Offset = 5u)]
		private ArrayList _outputValueFieldPairs;
		[ARStructMemTypeInfo(Name = "windowMode", Offset = 6u)]
		private int _windowMode;
		[ARStructMemTypeInfo(Name = "targetLocation", Offset = 7u)]
		private string _targetLocation;
		[ARStructMemTypeInfo(Name = "query", Offset = 8u)]
		private string _query;
		[ARStructMemTypeInfo(Name = "noMatchContinue", Offset = 9u)]
		private bool _noMatchContinue;
		[ARStructMemTypeInfo(Name = "suppressEmptyLst", Offset = 10u)]
		private bool _suppressEmptyLst;
		[ARStructMemTypeInfo(Name = "msg", Offset = 11u)]
		private MessageAction _msg;
		[ARStructMemTypeInfo(Name = "pollinginterval", Offset = 12u)]
		private uint _pollinginterval;
		[ARStructMemTypeInfo(Name = "reportString", Offset = 13u)]
		private string _reportString;
		[ARStructMemTypeInfo(Name = "sortList", Offset = 14u)]
		private ArrayList _sortList;
		private bool _inputByLikeIds;
		private bool _isInputSetToDefaults;
		private bool _outputByLikeIds;
		private bool _isOutputSetToDefaults;
		private string _sampleServer;
		private string _sampleForm;
		public string ServerName
		{
			get
			{
				return this._serverName;
			}
			set
			{
				this._serverName = value;
			}
		}
		public string FormName
		{
			get
			{
				return this._formName;
			}
			set
			{
				this._formName = value;
			}
		}
		public string VuiLabel
		{
			get
			{
				return this._vuiLabel;
			}
			set
			{
				this._vuiLabel = value;
			}
		}
		public bool CloseBox
		{
			get
			{
				return this._closeBox;
			}
			set
			{
				this._closeBox = value;
			}
		}
		public ArrayList InputValueFieldPairs
		{
			get
			{
				return this._inputValueFieldPairs;
			}
			set
			{
				this._inputValueFieldPairs = value;
			}
		}
		public ArrayList OutputValueFieldPairs
		{
			get
			{
				return this._outputValueFieldPairs;
			}
			set
			{
				this._outputValueFieldPairs = value;
			}
		}
		public int WindowMode
		{
			get
			{
				return this._windowMode;
			}
			set
			{
				this._windowMode = value;
			}
		}
		public string TargetLocation
		{
			get
			{
				return this._targetLocation;
			}
			set
			{
				this._targetLocation = value;
			}
		}
		public string Query
		{
			get
			{
				return this._query;
			}
			set
			{
				this._query = value;
			}
		}
		public bool NoMatchContinue
		{
			get
			{
				return this._noMatchContinue;
			}
			set
			{
				this._noMatchContinue = value;
			}
		}
		public bool SuppressEmptyList
		{
			get
			{
				return this._suppressEmptyLst;
			}
			set
			{
				this._suppressEmptyLst = value;
			}
		}
		public MessageAction Msg
		{
			get
			{
				return this._msg;
			}
			set
			{
				this._msg = value;
			}
		}
		public uint PollingInterval
		{
			get
			{
				return this._pollinginterval;
			}
			set
			{
				this._pollinginterval = value;
			}
		}
		public string ReportString
		{
			get
			{
				return this._reportString;
			}
			set
			{
				this._reportString = value;
			}
		}
		public ArrayList SortList
		{
			get
			{
				return this._sortList;
			}
			set
			{
				this._sortList = value;
			}
		}
		public bool IsInputByMatchingIds
		{
			get
			{
				return this._inputByLikeIds;
			}
			set
			{
				if (this._inputByLikeIds == value)
				{
					return;
				}
				this.InputValueFieldPairs = new ArrayList();
				this._inputByLikeIds = value;
			}
		}
		public bool IsInputSetToDefaults
		{
			get
			{
				return this._isInputSetToDefaults;
			}
			set
			{
				if (this._isInputSetToDefaults == value)
				{
					return;
				}
				this.InputValueFieldPairs = new ArrayList();
				this._isInputSetToDefaults = value;
			}
		}
		public bool IsOutputByMatchingIds
		{
			get
			{
				return this._outputByLikeIds;
			}
			set
			{
				if (this._outputByLikeIds == value)
				{
					return;
				}
				this.OutputValueFieldPairs = new ArrayList();
				this._outputByLikeIds = value;
			}
		}
		public bool IsOutputSetToDefaults
		{
			get
			{
				return this._isOutputSetToDefaults;
			}
			set
			{
				if (this._isOutputSetToDefaults == value)
				{
					return;
				}
				this.OutputValueFieldPairs = new ArrayList();
				this._isOutputSetToDefaults = value;
			}
		}
		public string SampleServer
		{
			get
			{
				return this._sampleServer;
			}
			set
			{
				this._sampleServer = value;
			}
		}
		public string SampleForm
		{
			get
			{
				return this._sampleForm;
			}
			set
			{
				this._sampleForm = value;
			}
		}
		public OpenWindowAction()
		{
		}
		internal OpenWindowAction(object[] rawData, Server server)
		{
			Session arg_28_0 = server.Session;
			int[] indexSpec = new int[1];
			arg_28_0.SecondaryServerName = (this.ServerName = (string)Util.GetAt(rawData, indexSpec));
			server.Session.CurrentRemoteForm = (this.FormName = (string)Util.GetAt(rawData, new int[]
			{
				1
			}));
			try
			{
				if (server.Session.CurrentOpenWindowSampleServerForms != null && server.Session.CurrentOpenWindowSampleServerForms.get_Item(server.Session.CurrentActionIndex - 1) != null && server.Session.CurrentOpenWindowSampleServerForms.get_Item(server.Session.CurrentActionIndex - 1) is Array)
				{
					server.Session.SecondaryServerName = (this.SampleServer = (string)((object[])server.Session.CurrentOpenWindowSampleServerForms.get_Item(server.Session.CurrentActionIndex - 1))[0]);
					server.Session.CurrentRemoteForm = (this.SampleForm = (string)((object[])server.Session.CurrentOpenWindowSampleServerForms.get_Item(server.Session.CurrentActionIndex - 1))[1]);
				}
			}
			catch (Exception)
			{
			}
			if (server.Session.SecondaryServerName != null && (server.Session.SecondaryServerName.Equals("@") || server.Session.SecondaryServerName.EndsWith("*")))
			{
				server.Session.SecondaryServerName = server.Session.PrimaryServerName;
			}
			if (server.Session.CurrentRemoteForm != null && (server.Session.CurrentRemoteForm.Equals("@") || server.Session.CurrentRemoteForm.Equals("*") || server.Session.CurrentRemoteForm.Equals("CURRENT SCREEN") || server.Session.CurrentRemoteForm.Equals("CURRENT TRANSACTION")))
			{
				server.Session.CurrentRemoteForm = server.Session.CurrentLocalForm;
			}
			this.VuiLabel = (string)Util.GetAt(rawData, new int[]
			{
				2
			});
			this.CloseBox = (Convert.ToInt32(Util.GetAt(rawData, new int[]
			{
				3
			})) != 0);
			string currentLocalForm = server.Session.CurrentLocalForm;
			string currentRemoteForm = server.Session.CurrentRemoteForm;
			server.Session.CurrentLocalForm = currentRemoteForm;
			server.Session.CurrentRemoteForm = currentLocalForm;
			this.InputValueFieldPairs = Util.BuildFieldAssignmentList(Util.GetAt(rawData, new int[]
			{
				4
			}), server.Session.GetServer(server.Session.SecondaryServerName), server.Session.CurrentLocalForm, server.Session.CurrentRemoteForm, out this._inputByLikeIds, out this._isInputSetToDefaults);
			server.Session.CurrentLocalForm = currentLocalForm;
			server.Session.CurrentRemoteForm = currentRemoteForm;
			this.OutputValueFieldPairs = Util.BuildFieldAssignmentList(Util.GetAt(rawData, new int[]
			{
				5
			}), server.Session.GetServer(server.Session.SecondaryServerName), server.Session.CurrentLocalForm, server.Session.CurrentRemoteForm, out this._outputByLikeIds, out this._isOutputSetToDefaults);
			this.WindowMode = Convert.ToInt32(Util.GetAt(rawData, new int[]
			{
				6
			}));
			this.TargetLocation = (string)Util.GetAt(rawData, new int[]
			{
				7
			});
			this.Query = server.FormatQualification(server.Session.CurrentRemoteForm, Util.GetAt(rawData, new int[]
			{
				8
			}));
			this.NoMatchContinue = (Convert.ToInt32(Util.GetAt(rawData, new int[]
			{
				9
			})) != 0);
			this.SuppressEmptyList = (Convert.ToInt32(Util.GetAt(rawData, new int[]
			{
				10
			})) != 0);
			this.Msg = (MessageAction)ARTypeMgr.Instance.ObjectFromVariant(typeof(MessageAction), Util.GetAt(rawData, new int[]
			{
				11
			}), server);
			this.PollingInterval = Convert.ToUInt32(Util.GetAt(rawData, new int[]
			{
				12
			}));
			this.ReportString = (string)Util.GetAt(rawData, new int[]
			{
				13
			});
			this.SortList = ARTypeMgr.Instance.ArrayListFromVariant(Type.GetType("Unknown"), (object[])Util.GetAt(rawData, new int[]
			{
				14
			}), server);
		}
		internal static OpenWindowAction createInstance(object[] rawData, Server server)
		{
			return new OpenWindowAction(rawData, server);
		}
		internal static object ToVariant(object given, Server server)
		{
			OpenWindowAction openWindowAction = given as OpenWindowAction;
			if (openWindowAction == null)
			{
				return given;
			}
			object[] array = new object[15];
			array[0] = openWindowAction.ServerName;
			array[1] = openWindowAction.FormName;
			array[2] = openWindowAction.VuiLabel;
			array[3] = (openWindowAction.CloseBox ? 1 : 0);
			server.Session.PrimaryServerName = server.ServerName;
			server.Session.SecondaryServerName = openWindowAction.ServerName;
			if (server.Session.SecondaryServerName != null && server.Session.SecondaryServerName.StartsWith("$") && server.Session.SecondaryServerName.EndsWith("$"))
			{
				server.Session.SecondaryServerName = openWindowAction.SampleServer;
			}
			if (server.Session.SecondaryServerName != null && (server.Session.SecondaryServerName.Equals("@") || server.Session.SecondaryServerName.Equals("*") || server.Session.SecondaryServerName.Equals("CURRENT SCREEN") || server.Session.SecondaryServerName.Equals("CURRENT TRANSACTION")))
			{
				server.Session.SecondaryServerName = server.Session.PrimaryServerName;
			}
			server.Session.CurrentRemoteForm = openWindowAction.FormName;
			if (server.Session.CurrentRemoteForm.StartsWith("$") && server.Session.CurrentRemoteForm.EndsWith("$"))
			{
				server.Session.CurrentRemoteForm = openWindowAction.SampleForm;
			}
			if (server.Session.CurrentRemoteForm != null && (server.Session.CurrentRemoteForm.Equals("@") || server.Session.CurrentRemoteForm.Equals("*") || server.Session.CurrentRemoteForm.Equals("CURRENT SCREEN") || server.Session.CurrentRemoteForm.Equals("CURRENT TRANSACTION")))
			{
				server.Session.CurrentRemoteForm = server.Session.CurrentLocalForm;
			}
			array[4] = Util.ConvertToARFieldAssignmentList(openWindowAction.InputValueFieldPairs, server.Session.GetServer(server.Session.SecondaryServerName), server.Session.CurrentLocalForm, server.Session.CurrentRemoteForm, false, false);
			array[5] = Util.ConvertToARFieldAssignmentList(openWindowAction.OutputValueFieldPairs, server.Session.GetServer(server.Session.PrimaryServerName), openWindowAction.FormName, server.Session.CurrentRemoteForm, false, false);
			array[6] = openWindowAction.WindowMode;
			array[7] = openWindowAction.TargetLocation;
			object obj = server.ParseSetIfQualification(server.Session.CurrentRemoteForm, server.Session.CurrentLocalForm, openWindowAction.Query);
			array[8] = obj;
			array[9] = (openWindowAction.NoMatchContinue ? 1 : 0);
			array[10] = (openWindowAction.SuppressEmptyList ? 1 : 0);
			array[11] = ARTypeMgr.Instance.toVariant(openWindowAction.Msg);
			array[12] = openWindowAction.PollingInterval;
			array[13] = openWindowAction.ReportString;
			array[14] = ARTypeMgr.Instance.toVariant(openWindowAction.SortList);
			return array;
		}
	}
}
